home *** CD-ROM | disk | FTP | other *** search
- Launch a Java development environment from your desktop
- or select it from the task bar if it is already running.
- Then follow the instructions below.
-
- Step 1: Create an applet named Primes. Primes will be
- passed an integer parameter from the HTML file that
- indicates the highest number for which to check for prime
- numbers. Write the init() method that will retrieve this
- value into an integer variable high.
-
- Step 2: Write a paint() method that will use nested
- loops. The outer loop will repeat while incrementing
- theNum from 1 to high. The inner will check each number
- to find out if it is prime. Remember that a number is
- prime if and only if it is only divisible by itself and
- 1. Do not use any break or continue statements in your
- program.
-
- Step 3: Print each prime number to the applet window.
-
- Step 4: Compile your applet, write an HTML file that will
- embed it in a web page, then load the applet in a web
- browser or applet viewer.
-
- Step 5: Now change the applet to include a continue
- statement or labeled break statement.
-
- Step 6: Compile and run your new applet.